package com.googlecode.stil.playground;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.ListView;

public class PlaygroundLauncher extends Activity {

	String[] listItems = new String[]{"Whack a sprite", "Kick ball", "Body test", "Hacky sack", "Block Balance", "Book Test1"};

	/**
	 * Called when the activity is first created.
	 */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);

		ListView listView = (ListView) findViewById(R.id.mylist);
		listView.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, android.R.id.text1, listItems));
		listView.setOnItemClickListener(new OnItemClickListener() {
			@Override
			public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
				System.out.println("position = " + position);
				System.out.println("id = " + id);
				Class<?> cls;
				switch (position) {
					case 0:
						cls = WhackASpriteActivity.class;
						break;
					case 1:
						cls = KickBallActivity.class;
						break;
					case 2:
						cls = BodyTest.class;
						break;
					case 3:
						cls = HackySackActivity.class;
						break;
					case 4:
						cls = BlockBalanceActivity.class;
						break;
					case 5:
						cls = PhysicsApplication.class;
						break;
					default:
						cls = null;
				}
				Intent intent = new Intent(PlaygroundLauncher.this, cls);
				startActivity(intent);
			}
		});
	}
}